import jwt from 'jsonwebtoken'
import s from './secretOrPrivateKey.js'


export default {
    sign(playLoad = {}, expiresIn = '365days') {
        return jwt.sign(playLoad, s.secret, {expiresIn})
    },

    verify(token) {
        let result = ''
        jwt.verify(token, s.secret, (error, data) => {
            if (error)
                result = null
            else
                result = data
        })
        return result
    }
}